$(function() {
	

	var mySwiper = null;

	var isOneShoe = true;


	window.onload = function(){
		
		setTimeout(function(){


			 $("#MyAudio")[0].play();//开启音乐
			 $('#cAdiou').addClass('cAdiou');

			},10);
	}



		// 音乐控制
	

		function AudioFun() {
			var myVid = $("#MyAudio")[0];
		
				$('#cAdiou').click(function(){
		        //防止冒泡
		        //event.stopPropagation();
		        if(myVid.paused) //如果当前是暂停状态
		        {   
		        	$('#cAdiou').addClass('cAdiou');
		            myVid.play();//播放
		            return;
		        }else{
		        //当前是播放状态
		        $('#cAdiou').removeClass('cAdiou');
		            myVid.pause(); //暂停
		        }
		    });


		}

		AudioFun();

		// setTimeout(function function_name(argument) {
		// 	// body...
		// 	$('#cAdiou').click();

		// },100)


		



	function SwiperConFun() {
		 mySwiper = new Swiper ('.swiper-container', {
		    direction: 'vertical',
		    
		    onInit: function(swiper){ //Swiper2.x的初始化是onFirstInit
			    swiperAnimateCache(swiper); //隐藏动画元素 
			    swiperAnimate(swiper); //初始化完成开始动画
			}, 
			onSlideChangeEnd: function(swiper){ 
			    swiperAnimate(swiper); //每个slide切换结束时也运行当前slide动画




			    if (swiper.activeIndex == 5 && isOneShoe) {


			    	setTimeout(function(argument) {
			    		$('#shou').show();
			    	},1000)

			    }else{
			    	$('#shou').hide();
			    }
			} 
		  })        		
	}

	SwiperConFun();


	function photoConFun(){
		console.log('photoConFun');

		var con = $('#photoCon');

		con.on('click', '#txixBut', function(event) {
			isOneShoe = false;

			con.find('div.animeta').removeClass('animetaSta');
			$('.photoConNei').removeClass('active');

			setTimeout(function(argument) {
				con.hide();
			},701)




		});


		$('.photo').click(function(event) {
			$('#shou').removeClass('shoushi')
			$('#shou').hide();
			var imgUrl = $(this).attr('data-img')
			console.log(imgUrl);
			$('.photoConNei').html('')
			con.show();




			loadImage('images/figure/'+imgUrl+'.jpg')


			function loadImage(url) {       
			    var img =new Image(); 
			    img.src = url;   


			    img.onload =function(){  
			        img.onload = null; 
					con.find('div.animeta').addClass('animetaSta');
					$('.photoConNei').append(img);
					$('.photoConNei').addClass('active');
					

		 			con.show();

			         
			    }  

			} 






			






		});


		

	}
	photoConFun();





})